<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>xmake v2.5.8 发布，新增 Pascal/Swig 程序和 Lua53 运行时支持</title>
    <meta name="description" content="xmake 是一个基于 Lua 的轻量级跨平台构建工具，使用 xmake.lua 维护项目构建，相比 makefile/CMakeLists.txt，配置语法更加简洁直观，对新手非常友好，短时间内就能快速入门，能够让用户把更多的精力集中在实际的项目开发上。这个版本，我们主要增加了对 Pascal 语言项目和 Sw...">

    
    <meta name="keywords" content="xmake,lua,C/C++,pascal,swig,lua5.3,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2021/10/08/xmake-update-v2.5.8/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>xmake v2.5.8 发布，新增 Pascal/Swig 程序和 Lua53 运行时支持</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2021-10-08
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/cn/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/cn/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#C%2FC%2B%2B" title="Tag: C/C++" rel="tag">C/C++</a-->
        <a href="/cn/tag/#C/C++" title="Tag: C/C++" rel="tag">C/C++</a>&nbsp;
    
        <!--a href="/tag/#pascal" title="Tag: pascal" rel="tag">pascal</a-->
        <a href="/cn/tag/#pascal" title="Tag: pascal" rel="tag">pascal</a>&nbsp;
    
        <!--a href="/tag/#swig" title="Tag: swig" rel="tag">swig</a-->
        <a href="/cn/tag/#swig" title="Tag: swig" rel="tag">swig</a>&nbsp;
    
        <!--a href="/tag/#lua5.3" title="Tag: lua5.3" rel="tag">lua5.3</a-->
        <a href="/cn/tag/#lua5.3" title="Tag: lua5.3" rel="tag">lua5.3</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p><a href="https://github.com/xmake-io/xmake">xmake</a> 是一个基于 Lua 的轻量级跨平台构建工具，使用 xmake.lua 维护项目构建，相比 makefile/CMakeLists.txt，配置语法更加简洁直观，对新手非常友好，短时间内就能快速入门，能够让用户把更多的精力集中在实际的项目开发上。</p>

<p>这个版本，我们主要增加了对 Pascal 语言项目和 Swig 模块的构建支持，而对于上个版本新增的 Vala 语言支持，我们也做了进一步改进，增加了对动态库和静态库的构建支持。</p>

<p>除此之外，xmake 现在也已经支持了可选的 Lua5.3 运行时，提供更好的跨平台支持能力，目前 xmake 已经能够在 LoongArch 架构上正常运行。</p>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">项目源码</a></li>
  <li><a href="https://xmake.io/#/zh-cn/">官方文档</a></li>
  <li><a href="https://xmake.io/#/zh-cn/about/course">入门课程</a></li>
</ul>

<h2 id="新特性介绍">新特性介绍</h2>

<h3 id="pascal-语言支持">Pascal 语言支持</h3>

<p>目前，我们可以使用跨平台的 Free pascal 工具链 fpc 去编译构建 Pascal 程序，例如：</p>

<h4 id="控制台程序">控制台程序</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.pas"</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="动态库程序">动态库程序</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/foo.pas"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.pas"</span><span class="p">)</span>
</code></pre>
</div>

<p>我们也可以通过 <code class="highlighter-rouge">add_fcflags()</code> 接口添加 Pascal 代码相关的编译选项。</p>

<p>更多例子见：<a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/pascal">Pascal examples</a></p>

<h3 id="vala-库编译支持">Vala 库编译支持</h3>

<p>上个版本，我们新增了对 Vala 语言的支持，但是之前只能支持控制台程序的编译，无法生成库文件。而这个版本中，我们额外增加了对静态库和动态库的编译支持。</p>

<h4 id="静态库程序">静态库程序</h4>

<p>我们能够通过 <code class="highlighter-rouge">add_values("vala.header", "mymath.h")</code> 设置导出的接口头文件名，通过 <code class="highlighter-rouge">add_values("vala.vapi", "mymath-1.0.vapi")</code> 设置导出的 vapi 文件名。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>

<span class="n">add_requires</span><span class="p">(</span><span class="s2">"glib"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"mymath"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"static"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"vala"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/mymath.vala"</span><span class="p">)</span>
    <span class="n">add_values</span><span class="p">(</span><span class="s2">"vala.header"</span><span class="p">,</span> <span class="s2">"mymath.h"</span><span class="p">)</span>
    <span class="n">add_values</span><span class="p">(</span><span class="s2">"vala.vapi"</span><span class="p">,</span> <span class="s2">"mymath-1.0.vapi"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"glib"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"mymath"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"vala"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.vala"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"glib"</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="动态库程序-1">动态库程序</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>

<span class="n">add_requires</span><span class="p">(</span><span class="s2">"glib"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"mymath"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"vala"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/mymath.vala"</span><span class="p">)</span>
    <span class="n">add_values</span><span class="p">(</span><span class="s2">"vala.header"</span><span class="p">,</span> <span class="s2">"mymath.h"</span><span class="p">)</span>
    <span class="n">add_values</span><span class="p">(</span><span class="s2">"vala.vapi"</span><span class="p">,</span> <span class="s2">"mymath-1.0.vapi"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"glib"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"mymath"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"vala"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.vala"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"glib"</span><span class="p">)</span>
</code></pre>
</div>

<p>更多例子见：<a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/vala">Vala examples</a></p>

<h3 id="swig-模块支持">Swig 模块支持</h3>

<p>我们提供了 <code class="highlighter-rouge">swig.c</code> 和 <code class="highlighter-rouge">swig.cpp</code> 规则，可以对指定的脚本语言，调用 swig 程序生成 c/c++ 模块接口代码，然后配合 xmake 的包管理系统实现完全自动化的模块和依赖包整合。</p>

<p>相关 issues: <a href="https://github.com/xmake-io/xmake/issues/1622">#1622</a></p>

<h4 id="luac-模块">Lua/C 模块</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"lua"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"example"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"swig.c"</span><span class="p">,</span> <span class="p">{</span><span class="n">moduletype</span> <span class="o">=</span> <span class="s2">"lua"</span><span class="p">})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/example.i"</span><span class="p">,</span> <span class="p">{</span><span class="n">swigflags</span> <span class="o">=</span> <span class="s2">"-no-old-metatable-bindings"</span><span class="p">})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/example.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"lua"</span><span class="p">)</span>
</code></pre>
</div>

<p>其中，swigflags 可以设置传递一些 swig 特有的 flags 选项。</p>

<h4 id="pythonc-模块">Python/C 模块</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"python 3.x"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"example"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"swig.c"</span><span class="p">,</span> <span class="p">{</span><span class="n">moduletype</span> <span class="o">=</span> <span class="s2">"python"</span><span class="p">})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/example.i"</span><span class="p">,</span> <span class="p">{</span><span class="n">scriptdir</span> <span class="o">=</span> <span class="s2">"share"</span><span class="p">})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/example.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"python"</span><span class="p">)</span>
</code></pre>
</div>

<p>如果设置了 scriptdir，那么我们执行安装的时候，会将对应模块的 python wrap 脚本安装到指定目录。</p>

<h4 id="pythonc-模块-1">Python/C++ 模块</h4>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.release"</span><span class="p">,</span> <span class="s2">"mode.debug"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"python 3.x"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"example"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"swig.cpp"</span><span class="p">,</span> <span class="p">{</span><span class="n">moduletype</span> <span class="o">=</span> <span class="s2">"python"</span><span class="p">})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/example.i"</span><span class="p">,</span> <span class="p">{</span><span class="n">scriptdir</span> <span class="o">=</span> <span class="s2">"share"</span><span class="p">})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/example.cpp"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"python"</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="lua53-运行时支持">Lua5.3 运行时支持</h3>

<p>xmake 之前一直使用的 Luajit 作为默认的运行时，因为当初考虑到 Luajit 相对更加快速，并且固定的 lua 5.1 语法更加适合 xmake 内部实现的需要。</p>

<p>但是考虑到 Luajit 的更新不给力，作者维护不是很积极，并且它的跨平台性比较差，对于一些新出的架构，比如：Loongarch，riscv 等支持不及时，这多少限制了 xmake 的平台支持力度。</p>

<p>为此，新版本中，我们也将 Lua5.3 作为可选的运行时内置了进来，我们只需要通过下面的命令编译安装 xmake，就可以从 Luajit 切换到 Lua5.3 运行时：</p>

<h4 id="linuxmacos">Linux/macOS</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>make <span class="nv">RUNTIME</span><span class="o">=</span>lua
</code></pre>
</div>

<h4 id="windows">Windows</h4>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span><span class="nb">cd </span>core
<span class="gp">$ </span>xmake f --runtime<span class="o">=</span>lua
<span class="gp">$ </span>xmake
</code></pre>
</div>

<p>目前，当前版本还是默认采用的 luajit 运行时，用户可以根据自己的需求切换到 Lua5.3 运行时，但这对于用户的项目 xmake.lua 配置脚本几乎没有任何兼容性影响。</p>

<p>因为 xmake 的配置接口都已经做了一层的抽象封装，一些 Luajit/Lua5.3 存在兼容性差异的原生接口是不会开放给用户使用的，所以对项目构建来说，是完全无感知的。</p>

<p>唯一的区别就是，带有 Lua5.3 的 xmake 支持更多的平台和架构。</p>

<h4 id="性能对比">性能对比</h4>

<p>我做过一些基础构建测试，不管是启动时间，构建性能还是内存占用，Lua5.3 和 Luajit 的 xmake 都几乎没有任何差别。因为对于构建系统，主要的性能瓶颈是在编译器上，自身脚本的损耗占比是非常小的。</p>

<p>而且 xmake 内部的一些底层 Lua 模块，比如 io，字符编码，字符串操作等，都自己用 c 代码全部重写过的，完全不依赖特定的 Lua 运行时引擎。</p>

<h4 id="是否会考虑默认切换到-lua">是否会考虑默认切换到 Lua?</h4>

<p>由于我们刚刚支持 Lua5.3，尽管目前测试下来已经比较稳定，但是为了确保用户环境不受到任何影响，我们还需要再观察一段时间，短期还是默认使用 Luajit。</p>

<p>等到 2.6.1 版本开始，我们会全面开始切换到 Lua5.3 作为默认的运行时环境，大家有兴趣的话，也可以线帮忙测试下，如果遇到问题，欢迎到 issues 上反馈。</p>

<h4 id="loongarch-架构支持">LoongArch 架构支持</h4>

<p>由于我们增加了 Lua5.3 运行时支持，所以现在我们已经可以支持再 LoongArch 架构上运行 xmake，并且所有测试例子都已经测试通过。</p>

<h4 id="lua-54">Lua 5.4</h4>

<p>目前，我们对 Lua 5.4 还保持观望状态，如果后面等 lua5.4 稳定了，我们也会尝试考虑继续升级到 Lua5.4。</p>

<h3 id="第三方源码混合编译支持">第三方源码混合编译支持</h3>

<h4 id="集成-cmake-代码库">集成 CMake 代码库</h4>

<p>新版本中，我们已经能够通过 xmake 的包模式直接集成自己项目中带有 CMakeLists.txt 的代码库，而不是通过远程下载安装。</p>

<p>相关 issues: <a href="https://github.com/xmake-io/xmake/issues/1714">#1714</a></p>

<p>例如，我们有如下项目结构：</p>

<div class="highlighter-rouge"><pre class="highlight"><code>├── foo
│   ├── CMakeLists.txt
│   └── src
│       ├── foo.c
│       └── foo.h
├── src
│   └── main.c
├── test.lua
└── xmake.lua
</code></pre>
</div>

<p>foo 目录下是一个使用 cmake 维护的静态库，而根目录下使用了 xmake 来维护，我们可以在 xmake.lua 中通过定义 <code class="highlighter-rouge">package("foo")</code> 包来描述如何构建 foo 代码库。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>

<span class="n">package</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"cmake"</span><span class="p">)</span>
    <span class="n">set_sourcedir</span><span class="p">(</span><span class="n">path</span><span class="p">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="p">.</span><span class="n">scriptdir</span><span class="p">(),</span> <span class="s2">"foo"</span><span class="p">))</span>
    <span class="n">on_install</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">package</span><span class="p">)</span>
        <span class="kd">local</span> <span class="n">configs</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"-DCMAKE_BUILD_TYPE="</span> <span class="o">..</span> <span class="p">(</span><span class="n">package</span><span class="p">:</span><span class="n">debug</span><span class="p">()</span> <span class="ow">and</span> <span class="s2">"Debug"</span> <span class="ow">or</span> <span class="s2">"Release"</span><span class="p">))</span>
        <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"-DBUILD_SHARED_LIBS="</span> <span class="o">..</span> <span class="p">(</span><span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span> <span class="ow">and</span> <span class="s2">"ON"</span> <span class="ow">or</span> <span class="s2">"OFF"</span><span class="p">))</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"package.tools.cmake"</span><span class="p">).</span><span class="n">install</span><span class="p">(</span><span class="n">package</span><span class="p">,</span> <span class="n">configs</span><span class="p">)</span>
    <span class="k">end</span><span class="p">)</span>
    <span class="n">on_test</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">package</span><span class="p">)</span>
        <span class="nb">assert</span><span class="p">(</span><span class="n">package</span><span class="p">:</span><span class="n">has_cfuncs</span><span class="p">(</span><span class="s2">"add"</span><span class="p">,</span> <span class="p">{</span><span class="n">includes</span> <span class="o">=</span> <span class="s2">"foo.h"</span><span class="p">}))</span>
    <span class="k">end</span><span class="p">)</span>
<span class="n">package_end</span><span class="p">()</span>

<span class="n">add_requires</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
</code></pre>
</div>

<p>其中，我们通过 <code class="highlighter-rouge">set_sourcedir()</code> 来设置 foo 包的代码目录位置，然后通过 import 导入 <code class="highlighter-rouge">package.tools.cmake</code> 辅助模块来调用 cmake 构建代码，xmake 会自动获取生成的 libfoo.a 和对应的头文件。</p>

<p>!&gt; 如果仅仅本地源码集成，我们不需要额外设置 <code class="highlighter-rouge">add_urls</code> 和 <code class="highlighter-rouge">add_versions</code>。</p>

<p>关于包的配置描述，详情见：<a href="https://xmake.io/#/zh-cn/package/remote_package?id=%e5%8c%85%e6%8f%8f%e8%bf%b0%e8%af%b4%e6%98%8e">包描述说明</a></p>

<p>定义完包后，我们就可以通过 <code class="highlighter-rouge">add_requires("foo")</code> 和 <code class="highlighter-rouge">add_packages("foo")</code> 来集成使用它了，就跟集成远程包一样的使用方式。</p>

<p>另外，<code class="highlighter-rouge">on_test</code> 是可选的，如果想要严格检测包的编译安装是否成功，可以在里面做一些测试。</p>

<p>完整例子见：<a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/c/library_with_cmakelists">Library with CMakeLists</a></p>

<h4 id="集成-autoconf-代码库">集成 autoconf 代码库</h4>

<p>我们也可以使用 <code class="highlighter-rouge">package.tools.autoconf</code> 来本地集成带有 autoconf 维护的第三方代码库。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">package</span><span class="p">(</span><span class="s2">"pcre2"</span><span class="p">)</span>

    <span class="n">set_sourcedir</span><span class="p">(</span><span class="n">path</span><span class="p">.</span><span class="n">join</span><span class="p">(</span><span class="n">os</span><span class="p">.</span><span class="n">scriptdir</span><span class="p">(),</span> <span class="s2">"3rd/pcre2"</span><span class="p">))</span>

    <span class="n">add_configs</span><span class="p">(</span><span class="s2">"jit"</span><span class="p">,</span> <span class="p">{</span><span class="n">description</span> <span class="o">=</span> <span class="s2">"Enable jit."</span><span class="p">,</span> <span class="n">default</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="nb">type</span> <span class="o">=</span> <span class="s2">"boolean"</span><span class="p">})</span>
    <span class="n">add_configs</span><span class="p">(</span><span class="s2">"bitwidth"</span><span class="p">,</span> <span class="p">{</span><span class="n">description</span> <span class="o">=</span> <span class="s2">"Set the code unit width."</span><span class="p">,</span> <span class="n">default</span> <span class="o">=</span> <span class="s2">"8"</span><span class="p">,</span> <span class="n">values</span> <span class="o">=</span> <span class="p">{</span><span class="s2">"8"</span><span class="p">,</span> <span class="s2">"16"</span><span class="p">,</span> <span class="s2">"32"</span><span class="p">}})</span>

    <span class="n">on_load</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">package</span><span class="p">)</span>
        <span class="kd">local</span> <span class="n">bitwidth</span> <span class="o">=</span> <span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"bitwidth"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"8"</span>
        <span class="n">package</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="s2">"links"</span><span class="p">,</span> <span class="s2">"pcre2-"</span> <span class="o">..</span> <span class="n">bitwidth</span><span class="p">)</span>
        <span class="n">package</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="s2">"defines"</span><span class="p">,</span> <span class="s2">"PCRE2_CODE_UNIT_WIDTH="</span> <span class="o">..</span> <span class="n">bitwidth</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span> <span class="k">then</span>
            <span class="n">package</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="s2">"defines"</span><span class="p">,</span> <span class="s2">"PCRE2_STATIC"</span><span class="p">)</span>
        <span class="k">end</span>
    <span class="k">end</span><span class="p">)</span>

    <span class="n">on_install</span><span class="p">(</span><span class="s2">"macosx"</span><span class="p">,</span> <span class="s2">"linux"</span><span class="p">,</span> <span class="s2">"mingw"</span><span class="p">,</span> <span class="k">function</span> <span class="p">(</span><span class="n">package</span><span class="p">)</span>
        <span class="kd">local</span> <span class="n">configs</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"--enable-shared="</span> <span class="o">..</span> <span class="p">(</span><span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span> <span class="ow">and</span> <span class="s2">"yes"</span> <span class="ow">or</span> <span class="s2">"no"</span><span class="p">))</span>
        <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"--enable-static="</span> <span class="o">..</span> <span class="p">(</span><span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span> <span class="ow">and</span> <span class="s2">"no"</span> <span class="ow">or</span> <span class="s2">"yes"</span><span class="p">))</span>
        <span class="k">if</span> <span class="n">package</span><span class="p">:</span><span class="n">debug</span><span class="p">()</span> <span class="k">then</span>
            <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"--enable-debug"</span><span class="p">)</span>
        <span class="k">end</span>
        <span class="k">if</span> <span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"pic"</span><span class="p">)</span> <span class="o">~=</span> <span class="kc">false</span> <span class="k">then</span>
            <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"--with-pic"</span><span class="p">)</span>
        <span class="k">end</span>
        <span class="k">if</span> <span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"jit"</span><span class="p">)</span> <span class="k">then</span>
            <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"--enable-jit"</span><span class="p">)</span>
        <span class="k">end</span>
        <span class="kd">local</span> <span class="n">bitwidth</span> <span class="o">=</span> <span class="n">package</span><span class="p">:</span><span class="n">config</span><span class="p">(</span><span class="s2">"bitwidth"</span><span class="p">)</span> <span class="ow">or</span> <span class="s2">"8"</span>
        <span class="k">if</span> <span class="n">bitwidth</span> <span class="o">~=</span> <span class="s2">"8"</span> <span class="k">then</span>
            <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"--disable-pcre2-8"</span><span class="p">)</span>
            <span class="nb">table.insert</span><span class="p">(</span><span class="n">configs</span><span class="p">,</span> <span class="s2">"--enable-pcre2-"</span> <span class="o">..</span> <span class="n">bitwidth</span><span class="p">)</span>
        <span class="k">end</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"package.tools.autoconf"</span><span class="p">).</span><span class="n">install</span><span class="p">(</span><span class="n">package</span><span class="p">,</span> <span class="n">configs</span><span class="p">)</span>
    <span class="k">end</span><span class="p">)</span>

    <span class="n">on_test</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">package</span><span class="p">)</span>
        <span class="nb">assert</span><span class="p">(</span><span class="n">package</span><span class="p">:</span><span class="n">has_cfuncs</span><span class="p">(</span><span class="s2">"pcre2_compile"</span><span class="p">,</span> <span class="p">{</span><span class="n">includes</span> <span class="o">=</span> <span class="s2">"pcre2.h"</span><span class="p">}))</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p><code class="highlighter-rouge">package.tools.autoconf</code> 和 <code class="highlighter-rouge">package.tools.cmake</code> 模块都是可以支持 mingw/cross/iphoneos/android 等交叉编译平台和工具链的，xmake 会自动传递对应的工具链进去，用户不需要做任何其他事情。</p>

<h4 id="集成其他构建系统">集成其他构建系统</h4>

<p>我们还支持集成 Meson/Scons/Make 等其他构建系统维护的代码库，仅仅只需要导入对应的构建辅助模块，这里就不一一细讲了，我们可以进一步查阅文档：<a href="https://xmake.io/#/zh-cn/package/local_3rd_source_library">集成本地第三方源码库</a></p>

<h3 id="改进编译器特性检测">改进编译器特性检测</h3>

<p>在之前的版本中，我们可以通过 <code class="highlighter-rouge">check_features</code> 辅助接口来检测指定的编译器特性，比如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">includes</span><span class="p">(</span><span class="s2">"check_features.lua"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"*.c"</span><span class="p">)</span>
    <span class="n">add_configfiles</span><span class="p">(</span><span class="s2">"config.h.in"</span><span class="p">)</span>
    <span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_CONSTEXPR"</span><span class="p">,</span> <span class="s2">"cxx_constexpr"</span><span class="p">)</span>
    <span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_CONSEXPR_AND_STATIC_ASSERT"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"cxx_constexpr"</span><span class="p">,</span> <span class="s2">"c_static_assert"</span><span class="p">},</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c++11"</span><span class="p">})</span>
</code></pre>
</div>

<p>config.h.in</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code><span class="err">$</span><span class="p">{</span><span class="n">define</span> <span class="n">HAS_CONSTEXPR</span><span class="p">}</span>
<span class="err">$</span><span class="p">{</span><span class="n">define</span> <span class="n">HAS_CONSEXPR_AND_STATIC_ASSERT</span><span class="p">}</span>
</code></pre>
</div>

<p>config.h</p>

<div class="language-c highlighter-rouge"><pre class="highlight"><code><span class="cm">/* #undef HAS_CONSTEXPR */</span>
<span class="cp">#define HAS_CONSEXPR_AND_STATIC_ASSERT 1
</span></code></pre>
</div>

<p>如果当前 cxx_constexpr 特性支持，就会在 config.h 中启用 HAS_CONSTEXPR 宏。</p>

<h4 id="新增-cc-标准支持检测">新增 C/C++ 标准支持检测</h4>

<p>2.5.8 之后，我们继续新增了对 cstd 和 c++ std 版本检测支持，相关 issues: <a href="https://github.com/xmake-io/xmake/issues/1715">#1715</a></p>

<p>例如：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_CXX_STD_98"</span><span class="p">,</span> <span class="s2">"cxx_std_98"</span><span class="p">)</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_CXX_STD_11"</span><span class="p">,</span> <span class="s2">"cxx_std_11"</span><span class="p">,</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c++11"</span><span class="p">})</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_CXX_STD_14"</span><span class="p">,</span> <span class="s2">"cxx_std_14"</span><span class="p">,</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c++14"</span><span class="p">})</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_CXX_STD_17"</span><span class="p">,</span> <span class="s2">"cxx_std_17"</span><span class="p">,</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c++17"</span><span class="p">})</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_CXX_STD_20"</span><span class="p">,</span> <span class="s2">"cxx_std_20"</span><span class="p">,</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c++20"</span><span class="p">})</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_C_STD_89"</span><span class="p">,</span> <span class="s2">"c_std_89"</span><span class="p">)</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_C_STD_99"</span><span class="p">,</span> <span class="s2">"c_std_99"</span><span class="p">)</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_C_STD_11"</span><span class="p">,</span> <span class="s2">"c_std_11"</span><span class="p">,</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c11"</span><span class="p">})</span>
<span class="n">configvar_check_features</span><span class="p">(</span><span class="s2">"HAS_C_STD_17"</span><span class="p">,</span> <span class="s2">"c_std_17"</span><span class="p">,</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c17"</span><span class="p">})</span>
</code></pre>
</div>

<h4 id="新增编译器内置宏检测">新增编译器内置宏检测</h4>

<p>我们还能检测编译器存在一些内置的宏定义，比如：<code class="highlighter-rouge">__GNUC__</code> 等，我们可以通过 <code class="highlighter-rouge">check_macros</code> 和 <code class="highlighter-rouge">configvar_check_macros</code> 辅助脚本来检测它们是否存在。</p>

<p>相关 issues: <a href="https://github.com/xmake-io/xmake/issues/1715">#1715</a></p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="c1">-- 检测宏是否定义</span>
<span class="n">configvar_check_macros</span><span class="p">(</span><span class="s2">"HAS_GCC"</span><span class="p">,</span> <span class="s2">"__GNUC__"</span><span class="p">)</span>
<span class="c1">-- 检测宏没有被定义</span>
<span class="n">configvar_check_macros</span><span class="p">(</span><span class="s2">"NO_GCC"</span><span class="p">,</span> <span class="s2">"__GNUC__"</span><span class="p">,</span> <span class="p">{</span><span class="n">defined</span> <span class="o">=</span> <span class="kc">false</span><span class="p">})</span>
<span class="c1">-- 检测宏条件</span>
<span class="n">configvar_check_macros</span><span class="p">(</span><span class="s2">"HAS_CXX20"</span><span class="p">,</span> <span class="s2">"__cplusplus &gt;= 202002L"</span><span class="p">,</span> <span class="p">{</span><span class="n">languages</span> <span class="o">=</span> <span class="s2">"c++20"</span><span class="p">})</span>
</code></pre>
</div>

<h3 id="增加对-qt-4x-的支持">增加对 Qt 4.x 的支持</h3>

<p>除了 Qt 5.x 和 6.x，我们对于一些基于 Qt 4.x 的老项目，xmake 也增加了支持。</p>

<h3 id="增加对-android-ndk-r23-的支持">增加对 Android NDK r23 的支持</h3>

<p>由于 google 对 Android NDK 的一些结构改动，导致 r23 影响了 xmake 对 android 项目部分编译特性的支持，在这个版本中，我们也做了修复。</p>

<h3 id="修复-vsxmake-插件-unicode-编码问题">修复 vsxmake 插件 Unicode 编码问题</h3>

<p>另外，如果基于 Unicode 作为项目目录，那么生成的 vsxmake 项目会收到影响，导致 vs 项目编译和访问上存在很多问题，我们也在新版本中做了修复。</p>

<h2 id="更新内容">更新内容</h2>

<h3 id="新特性">新特性</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/388">#388</a>: Pascal 语言支持，可以使用 fpc 来编译 free pascal</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1682">#1682</a>: 添加可选的额lua5.3 运行时替代 luajit，提供更好的平台兼容性。</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1622">#1622</a>: 支持 Swig</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1714">#1714</a>: 支持内置 cmake 等第三方项目的混合编译</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1715">#1715</a>: 支持探测编译器语言标准特性，并且新增 <code class="highlighter-rouge">check_macros</code> 检测接口</li>
  <li>xmake 支持在 Loongarch 架构上运行</li>
</ul>

<h3 id="改进">改进</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1618">#1618</a>: 改进 vala 支持构建动态库和静态库程序</li>
  <li>改进 Qt 规则去支持 Qt 4.x</li>
  <li>改进 <code class="highlighter-rouge">set_symbols("debug")</code> 支持 clang/windows 生成 pdb 文件</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1638">#1638</a>: 改进合并静态库</li>
  <li>改进 on_load/after_load 去支持动态的添加 target deps</li>
  <li><a href="https://github.com/xmake-io/xmake/pull/1675">#1675</a>: 针对 mingw 平台，重命名动态库和导入库文件名后缀</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1694">#1694</a>: 支持在 set_configvar 中定义一个不带引号的字符串变量</li>
  <li>改进对 Android NDK r23 的支持</li>
  <li>为 <code class="highlighter-rouge">set_languages</code> 新增 <code class="highlighter-rouge">c++latest</code> 和 <code class="highlighter-rouge">clatest</code> 配置值</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1720">#1720</a>: 添加 <code class="highlighter-rouge">save_scope</code> 和 <code class="highlighter-rouge">restore_scope</code> 去修复 <code class="highlighter-rouge">check_xxx</code> 相关接口</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1726">#1726</a>: 改进 compile_commands 生成器去支持 nvcc</li>
</ul>

<h3 id="bugs-修复">Bugs 修复</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1671">#1671</a>: 修复安装预编译包后，*.cmake 里面的一些不正确的绝对路径</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1689">#1689</a>: 修复 vsxmake 插件的 unicode 字符显示和加载问题</li>
</ul>


        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="english">English</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 is released, Support Pascal/Swig program and Lua53 runtime
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        
            </ul>
        

        
        
            
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">相关文章</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/17/xmake-update-v2.6.2/">xmake v2.6.2 发布，新增 Linux 内核驱动模块构建支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 发布，使用 Lua5.4 运行时，Rust 和 C++ 混合编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 发布，改进 C++20 模块，并支持 Nim, Keil MDK 和 Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>下一篇</strong> <a href="/cn/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 发布，改进 C++20 模块，并支持 Nim, Keil MDK 和 Unity Build</a></p>
        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
